package com.congthoidai.testnhatnghe;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity {
	ImageView iv;
	Button bt;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		iv=(ImageView)findViewById(R.id.imageView1);
		bt=(Button)findViewById(R.id.button1);	
		bt.setOnClickListener(new View.OnClickListener() {
			int manghinh[]={R.drawable.sample_0,
					R.drawable.sample_1,
					R.drawable.sample_2};
			int vitri=0;
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				vitri++;
				if(vitri>=manghinh.length)
					vitri=0;
				iv.setImageResource(manghinh[vitri]);

			}
		});


	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
